/* 全局基础样式 */
:root {
  /* 颜色变量 */
  --primary-color: #1976d2;
  --primary-dark: #1565c0;
  --primary-light: #bbdefb;
  --secondary-color: #64b5f6;
  --success-color: #4caf50;
  --error-color: #f44336;
  --warning-color: #ff9800;
  --info-color: #2196f3;
  
  /* 中性色 */
  --text-primary: #212121;
  --text-secondary: #757575;
  --text-disabled: #bdbdbd;
  --divider-color: #e0e0e0;
  --background-primary: #ffffff;
  --background-secondary: #f5f5f5;
  --background-hover: #f0f0f0;
  
  /* 尺寸变量 */
  --border-radius: 4px;
  --border-radius-large: 8px;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --box-shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
  
  /* 字体 */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;

  /* 字体渲染 */
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

/* 重置样式 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  background-color: var(--background-secondary);
  color: var(--text-primary);
  overflow-x: hidden;
}

/* 根元素 */
#root {
  min-height: 100vh;
  width: 100%;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

/* 段落样式 */
p {
  margin: 0 0 1rem 0;
}

/* 列表样式 */
ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 链接样式 */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 按钮基础样式 */
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: inherit;
  padding: 0;
}

button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 输入框基础样式 */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border: 1px solid var(--divider-color);
  border-radius: var(--border-radius);
  padding: 8px 12px;
  background-color: var(--background-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

input:disabled, textarea:disabled, select:disabled {
  background-color: var(--background-secondary);
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* 图片样式 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider-color);
}

th {
  font-weight: 600;
  background-color: var(--background-secondary);
}

/* 代码样式 */
code, pre {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background-color: var(--background-secondary);
  border-radius: var(--border-radius);
}

code {
  padding: 2px 4px;
  font-size: 0.9em;
}

pre {
  padding: 16px;
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 1rem 0;
}

pre code {
  padding: 0;
  background: none;
}

/* 引用样式 */
blockquote {
  margin: 0 0 1rem 0;
  padding: 8px 16px;
  border-left: 4px solid var(--primary-color);
  background-color: var(--background-secondary);
  font-style: italic;
}

/* 工具类 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0066cc;
    --primary-dark: #0052a3;
    --text-primary: #000000;
    --text-secondary: #333333;
    --background-primary: #ffffff;
    --background-secondary: #f0f0f0;
    --divider-color: #000000;
  }
}
